﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using NHibernate.Tool.hbm2ddl;
using FluentNHibernate.Automapping;
using System.Configuration;
using LANDSCAPEBIZ = Landscape.Business;
using FNH = Landscape.Business.FNH;
using System.Security.Cryptography;
//using Landscape.Business.Interface;


namespace Landscape.ConsoleTest
{
    class Program
    {
        static void Main(string[] args)
        {
           /* var cfg = new NCRAutoMapingConfig();
            var configuration = Fluently.Configure()
                .Database(OracleClientConfiguration.Oracle10)
                .Mappings(m =>
                    {
                        m.AutoMappings.Add(
                           AutoMap.AssemblyOf<LANDSCAPEBIZ.Entities.Role>(cfg)
                           .Conventions.AddFromAssemblyOf<TableNameConvention>());
                    })
                .BuildConfiguration();
            var exporter = new SchemaExport(configuration);
            exporter.SetOutputFile(ConfigurationManager.AppSettings["SCRIPT_FILE"]);
            exporter.Execute(true, false, false);
            Console.Write("Hit enter to exit:");
            Console.ReadLine();*/

           // SyncIntefaceFactory fac = new SyncIntefaceFactory();
        }
    }

    class LandscapeProgram
    {
        static void Main(string[] args)
        {
            var cfg = new FNH.LandscapeAutoMapingConfig();
            var configuration = Fluently.Configure()
                .Database(MsSqlConfiguration.MsSql2008.ConnectionString(ConfigurationManager.ConnectionStrings["LANDSCAPE_DEBUG"].ConnectionString).ShowSql())
                .Diagnostics(d => { d.OutputToFile(ConfigurationManager.AppSettings["TRACE_FILE"]); d.Enable(); })
                .Mappings(m =>
                    {
                        m.AutoMappings.Add(
                           AutoMap.AssemblyOf<LANDSCAPEBIZ.Entities.Role>(cfg)
                           .Conventions.AddFromAssemblyOf<FNH.TableNameConvention>()
                           .Conventions.AddFromAssemblyOf<FNH.CascadeAll>()
                       .Conventions.AddFromAssemblyOf<FNH.PropertyConvention>()                       
                       .Override<LANDSCAPEBIZ.Entities.SystemResourceMap>(x => x.References<LANDSCAPEBIZ.Entities.UserMaster>(exp => exp.User, "User_id"))
                       .Override<LANDSCAPEBIZ.Entities.SystemModule>(x => x.HasManyToMany<LANDSCAPEBIZ.Entities.Department>(exp => exp.Departments)));
                        m.AutoMappings.Last().ValidationEnabled = false;
                    })
                .BuildConfiguration();
            var exporter = new SchemaExport(configuration);
            exporter.SetOutputFile(ConfigurationManager.AppSettings["SCRIPT_FILE"]);
            exporter.Execute(true, false, false);
            Console.Write("Hit enter to exit:");
            Console.ReadLine();

            //SyncIntefaceFactory fac = new SyncIntefaceFactory();
            //var client = fac.CreateInterfaceClient("InetMailSyncClient");
            //client.PullMessages();

            //InetMailConfigSection t = (InetMailConfigSection)ConfigurationManager.GetSection("InetMailConfig");


        }
    }

    class Test
    {
        static void Main(string[] args)
        {
            //TripleDESCryptoServiceProvider provider = new TripleDESCryptoServiceProvider();

            Console.Write("Hit enter to exit:");
            Console.ReadLine();
        }
    }
}
